//
//  ViewController.m
//  CATransitionFade
//
//  Created by Xwoder on 17/1/30.
//  Copyright © 2017年 Xwoder. All rights reserved.
//

#import "ViewController.h"
#import "UIView+ALQuickFrame.h"

@interface ViewController ()

@property (nonatomic, weak) UIView *orangeView;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor whiteColor];
    
    UIView *orangeView = [[UIView alloc] init];
    orangeView.backgroundColor = [UIColor orangeColor];
    orangeView.size = CGSizeMake(320, 320);
    orangeView.center = self.view.center;
    [self.view addSubview:orangeView];
    self.orangeView = orangeView;
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    
    self.orangeView.backgroundColor = [UIColor greenColor];
    
    CATransition *transition = [[CATransition alloc] init];
    transition.type = kCATransitionFade;
    transition.duration = 2;
    [self.view.layer addAnimation:transition forKey:nil];
    // [self.orangeView.layer addAnimation:transition forKey:nil];
}


@end
